#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<assert.h>
#define MAX 10

void Reverse(int* a,int* b)
{
	assert(a != NULL && b != NULL);
	int* left = a;
	int* right = b;

	while (left < right)
	{
		int tmp = *left;
		*left = *right;
		*right = tmp;
		right--;
		left++;
	}
}

int main()
{
	int arr[MAX] = { 1,2,3,4,5,6,7,8,9,10 };
	int n = 0;
	scanf("%d", &n);
	if (n > MAX)
	{
		n %= MAX;
	}
	Reverse(arr, arr + MAX - n - 1);
	Reverse(arr + MAX - n, arr + MAX - 1);
	Reverse(arr, arr + MAX - 1);

	for (int i = 0; i < MAX; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}